package com.biz.primus.ms.geo.dao.repository;

import com.biz.primus.base.enums.CommonStatus;
import com.biz.primus.ms.base.jpa.repository.CommonJpaRepository;
import com.biz.primus.ms.geo.dao.po.Province;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author JKLiues
 * @date 2017/11/8
 */
@Repository
public interface ProvinceRepository extends CommonJpaRepository<Province, Integer>, ProvinceDao {

    /**
     * 根据百度地理名称查询省份信息
     *
     * @param baiduname 百度地理名称
     * @return 省份po
     */
    @Query("from Province province where province.baiduname = ?1")
    Province findByBaiduname(String baiduname);

    /**
     * 通过status找省
     *
     * @param status 状态
     * @return List<Province>
     */
    List<Province> findByStatus(CommonStatus status);
}
